<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('综合图表')" />
</head>
<body class="gray-bg">
<div class="container-div">
        <div class="row" style="height: auto">
            <div class="col-md-12 search-collapse">
                <form id="formId" class="form-inline">
                    <label>开始：</label>
                    <input type="text" class="form-control input-small" id="dateBegin" placeholder="yyyy-MM-dd">
                    <label>结束：</label>
                    <input type="text" class="form-control input-small" id="dateEnd" placeholder="yyyy-MM-dd">
                    <a class="btn btn-primary btn-rounded btn-sm" onclick="searchData()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                </form>
            </div>
        </div>

        <div class="row" >
            <div class="col-md-6" style="margin-top: 15px;padding-left: 0px">
                <div name="viewContent" type="chart" class="ibox-content">
                    <div name="param" style="width: 100%;height: 400px">{"shapeStyleVO":{"title":"基础饼图样例","shapeType":"pie","shapeXVO":{"fieldName":"NA_DIM_NURSINGLEVEL"},"shapeYVOList":[{"name":"IDX_HLDJ","formatter":"人次"}]},"queryParamVO":{}}</div>
                </div>
            </div>
            <div class="col-md-6" style="margin-top: 15px;padding-left: 0px">
                <div name="viewContent" type="chart" class="ibox-content">
                    <div name="param" style="width: 100%;height: 400px">{"shapeStyleVO":{"title":"基础饼图样例","shapeType":"pie","shapeXVO":{"fieldName":"NA_DIM_NURSINGLEVEL"},"shapeYVOList":[{"name":"IDX_HLDJ","formatter":"人次"}]},"queryParamVO":{}}</div>
                </div>
            </div>
        </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: echarts-js" />
<script>
    $(function() {

        $("div[name=viewContent]").each(function (index,item) {
            if($(this).attr("type")=="chart") {
                var paramDiv = $(this).find("div[name=param]");
                var param = paramDiv.html();
                paramDiv.html("");
                $.ajax({
                    url: '/echar/demo/pie',
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json;charset=UTF-8',
                    data: param,
                    success: function (result) {
                        if(result.code==0) {

                            var option = eval('(' + result.data + ')');
                            var echartsInstance=echarts.init(paramDiv[0]);
                            echartsInstance.setOption(option);
                        }
                    }
                });
            }
        });
    });
</script>
</body>
</html>